import Taro, {Component} from '@tarojs/taro'
import {View, Text} from '@tarojs/components'
import attr_item from "./attr_item"
export default class attrbox extends Component {
  constructor(props) {
    super(props)
    this.state = {}
  }

  componentDidMount() {

  }

  itemClick(key,i)
  {
    this.props.onAttrItemClick(key,i)
  }

  render() {
    const itemlist = this.props.attrlist

    return (
      <View>
        {itemlist && itemlist.length > 0 && itemlist.map((item, i) => {
          return (<View key={i} style={{display:"flex",alignItems:"center"}}>
              <View style={{padding: "10px", display: "flex", alignItems: "center",width:"50px"}}>
                <Text style={{fontSize: "14px"}}>{item.name}</Text>
              </View>
              <View style={{flex:1}}>
              <attr_item  onAttrClick={this.itemClick} itemlist={item.item} f_key={item.id}/>
              </View>

            </View>
          )
        })}


      </View>
    )
  }
}


